package com.WFinstitute.util;

import java.util.List;

import com.WFinstitute.domain.Menu;

/**
 * 菜单处理类
 * @author 匹夫
 * @date 2016-7-23 下午4:02:09
 * @function
 */
public class MenuUtil {
	//把得到的菜单list转化为json
	public static String getMenuStr(List<Menu> list){
		StringBuffer sb =new StringBuffer();
		sb.append("[{id:'1',menu:[{text:'系统管理',items:[");
		for (Menu menu : list) {
			sb.append("{id:+'"+menu.getId()+"',text:'"+menu.getName()+"',href:'"+menu.getHref()+"'}");
			sb.append(",");
		}
		sb.deleteCharAt(sb.length()-1);
		sb.append("]}]}]");
		return sb.toString();
	}

}
